#ifndef TCPSERVER_H
#define TCPSERVER_H
#include <QTcpServer>
#include "clienthandler.h"
#include <QObject>

class TcpServer : public QObject
{
    Q_OBJECT
public:

    static TcpServer* getInstanse();
    void writeToClients(const QByteArray &data);
    void onReadMessage();
    QTcpSocket* socketSender();
    ~TcpServer();

signals:
    void received(const QByteArray &,QTcpSocket*);

public slots:
    void onNewConnection();

private:
    explicit TcpServer(QObject *parent = 0);
    static TcpServer *m_pInstance;
    QTcpServer *mServer;
    QList<ClientHandler*> m_clientlist;


};

#endif // TCPSERVER_H
